package a02_链表;

/**
 * <p>
 * a04_反转链表复习5
 * </p>
 *
 * @author flyduck
 * @since 2024/12/31
 */
public class a04_反转链表复习5 {

    public ListNode reverseList(ListNode head) {
        ListNode prevNode = null;
        ListNode currentNode = head;
        while (currentNode != null) {
            ListNode next = currentNode.next;

            currentNode.next = prevNode;

            prevNode = currentNode;
            currentNode = next;
        }
        return prevNode;

    }
}
